
//
//  UITextField+CPJTextField.m
//  成品家
//
//  Created by YYY on 2017/3/7.
//  Copyright © 2017年 成品家（北京）网路科技有限公司. All rights reserved.
//

#import "UITextField+CPJTextField.h"

@implementation UITextField (CPJTextField)

//设置文本框属性
-(void)setTextFieldAttribute:(UIColor *)textColor fontSize:(CGFloat)fontSize placeHolderStr:(NSString *)placeHolderStr placeHolderColor:(UIColor *)placeHolderColor placeHolderFontSize:(CGFloat)placeHolderFontSize
{
    //返回键类型
    self.returnKeyType = UIReturnKeyDefault;
    //自动大写
    self.autocapitalizationType = UITextAutocapitalizationTypeNone;
    //自动纠正
    self.autocorrectionType = UITextAutocorrectionTypeDefault;
    //清除按钮
    self.clearButtonMode = UITextFieldViewModeWhileEditing;
    
    self.textColor = textColor;
    self.font = [UIFont systemFontOfSize:fontSize];
    
//    self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
    //占位符内容
    self.placeholder = placeHolderStr;
    //占位符颜色
    [self setValue:placeHolderColor forKeyPath:@"_placeholderLabel.textColor"];
    //占位符字体
    [self setValue:[UIFont systemFontOfSize:placeHolderFontSize] forKeyPath:@"_placeholderLabel.font"];
    
}
@end
